<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:local="clr-namespace:Sobiens.WPF.Controls.BreadcrumbBarControl">


    <LinearGradientBrush x:Key="mouseOverBtnBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFEAF6FD" Offset="0"/>
        <GradientStop Color="#FFD7EFFC" Offset="0.5"/>
        <GradientStop Color="#FFBDE6FD" Offset="0.5"/>
        <GradientStop Color="#FFA6D9F4" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="mousePressedBtnBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="#FFC2E4F6" Offset="0"/>
        <GradientStop Color="#FFC2E4F6" Offset="0.5"/>
        <GradientStop Color="#FFA9D9F2" Offset="0.5"/>
        <GradientStop Color="#FF90CBEB" Offset="1"/>
    </LinearGradientBrush>
    <LinearGradientBrush x:Key="GradientBorderBrush" StartPoint="0,0" EndPoint="0,1">
        <GradientStop Color="White" Offset="0" />
        <GradientStop Color="#FFCECECE" Offset="1" />
    </LinearGradientBrush>
    <SolidColorBrush x:Key="borderBrush" Color="#C0000000"/>
    <SolidColorBrush x:Key="borderShadowBrush" Color="#60000000"/>
    <BooleanToVisibilityConverter x:Key="boolToVisible"/>
    <ImageSourceConverter x:Key="imgConverter"/>

    <Geometry x:Key="RightArrow">M0,0 L5,3.5 0,7 z</Geometry>
    <Geometry x:Key="DownArrow">M0,3 L7,3 3.5,7 z</Geometry>
    <Geometry x:Key="OverflowArrow">F1 M7,0 L4,3 7,6 M3,0 L0,3 3,6</Geometry>

    <!--DropDownButtonTemplate-->
    <ControlTemplate TargetType="{x:Type ToggleButton}" x:Key="DropDownButtonTemplate">
        <local:AeroChrome  SnapsToDevicePixels="True" Focusable="False" x:Name="chrome"
            BorderBrush="{StaticResource borderBrush}"
            BorderThickness="1"
            RenderMouseOver="{TemplateBinding IsMouseOver}" 
            RenderPressed="{TemplateBinding IsPressed}" >
            <local:AeroChrome.Content>
                <Path x:Name="arrow" Data="{StaticResource DownArrow}" SnapsToDevicePixels="True" VerticalAlignment="Center" HorizontalAlignment="Center" Fill="Black" Focusable="False"/>
            </local:AeroChrome.Content>
        </local:AeroChrome>
        <ControlTemplate.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter TargetName="chrome" Property="RenderMouseOver" Value="True"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--ButtonTemplate-->
    <ControlTemplate TargetType="{x:Type Button}" x:Key="ButtonTemplate">
        <Border Margin="-1,-1,0,-1" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" Background="Transparent" SnapsToDevicePixels="True" Focusable="False">
            <local:AeroChrome  SnapsToDevicePixels="True" x:Name="chrome" Focusable="False"
            BorderBrush="{StaticResource borderBrush}"
            BorderThickness="1"
             Margin="-1"
            RenderMouseOver="{TemplateBinding IsMouseOver}" 
            RenderPressed="{TemplateBinding IsPressed}" 
            Content="{TemplateBinding Content}"/>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="IsFocused" Value="True">
                <Setter TargetName="chrome" Property="RenderMouseOver" Value="True"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <!--BreadcrumbItem-->
    <Style TargetType="{x:Type local:BreadcrumbItem}">
        <Setter Property="Focusable" Value="False"/>
        <Setter Property="BorderBrush" Value="{StaticResource borderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:BreadcrumbItem}">
                    <Border Background="Transparent" Focusable="False"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <DockPanel>
                            <local:BreadcrumbButton x:Name="PART_Header" 
                                                    DataContext="{Binding}"
                                                    IsImageVisible="{TemplateBinding IsRoot}"
                                                    IsButtonVisible="{TemplateBinding IsButtonVisible}"
                                                    ItemTemplate="{TemplateBinding OverflowItemTemplate}"
                                                    ItemTemplateSelector="{TemplateBinding OverflowItemTemplateSelector}"
                                                    IsDropDownPressed="{Binding IsDropDownPressed, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                                                    SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                                                    Image ="{TemplateBinding Image}"
                                                    Header="{TemplateBinding Header}" ItemsSource="{Binding Items, RelativeSource={RelativeSource TemplatedParent}}">
                            </local:BreadcrumbButton>
                            <ContentControl x:Name="PART_Selected"  Focusable="False" Content="{TemplateBinding SelectedBreadcrumb}" />
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsRoot" Value="True">
                            <Setter Property="EnableVisualButtonStyle" Value="False" TargetName="PART_Header"/>
                        </Trigger>
                        
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="progressBarTemplate" TargetType="ProgressBar" 
                     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                     xmlns:s="clr-namespace:System;assembly=mscorlib">
        <Grid Name="Background" SnapsToDevicePixels="True">
            <Rectangle Name="PART_Track" Margin="1,1,1,1" />
            <Decorator Name="PART_Indicator" Margin="1,1,1,1" HorizontalAlignment="Left">
                <Grid Name="Foreground">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition MaxWidth="15" />
                        <ColumnDefinition Width="0.1*" />
                        <ColumnDefinition MaxWidth="15" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Name="Indicator" Grid.ColumnSpan="3" Grid.RowSpan="2" />
                    <Rectangle Fill="{TemplateBinding TextElement.Foreground}" Name="Animation" OpacityMask="{x:Null}" Grid.ColumnSpan="3" Grid.RowSpan="2" />
                    <Rectangle Name="LeftDark" Margin="1,1,0,1" Grid.RowSpan="2">
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#0C000000" Offset="0" />
                                    <GradientStop Color="#20000000" Offset="0.3" />
                                    <GradientStop Color="#00000000" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Rectangle RadiusX="1" RadiusY="1" Name="RightDark" Margin="0,1,1,1" Grid.Column="2" Grid.RowSpan="2">
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#00000000" Offset="0" />
                                    <GradientStop Color="#20000000" Offset="0.7" />
                                    <GradientStop Color="#0C000000" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Rectangle Name="LeftLight" Grid.Column="0" Grid.Row="2">
                        <Rectangle.Fill>
                            <RadialGradientBrush RadiusX="1" RadiusY="1" RelativeTransform="1,0,0,1,0.5,0.5">
                                <RadialGradientBrush.GradientStops>
                                    <GradientStop Color="#60FFFFC4" Offset="0" />
                                    <GradientStop Color="#00FFFFC4" Offset="1" />
                                </RadialGradientBrush.GradientStops>
                            </RadialGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Rectangle Name="CenterLight" Grid.Column="1" Grid.Row="2">
                        <Rectangle.Fill>
                            <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#60FFFFC4" Offset="0" />
                                    <GradientStop Color="#00FFFFC4" Offset="1" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Rectangle Name="RightLight" Grid.Column="2" Grid.Row="2">
                        <Rectangle.Fill>
                            <RadialGradientBrush RadiusX="1" RadiusY="1" RelativeTransform="1,0,0,1,-0.5,0.5">
                                <RadialGradientBrush.GradientStops>
                                    <GradientStop Color="#60FFFFC4" Offset="0" />
                                    <GradientStop Color="#00FFFFC4" Offset="1" />
                                </RadialGradientBrush.GradientStops>
                            </RadialGradientBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                    <Border Name="Highlight1" Grid.ColumnSpan="3" Grid.RowSpan="2">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#90FFFFFF" Offset="0.5385" />
                                    <GradientStop Color="#00FFFFFF" Offset="0.5385" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                    <Border Name="Highlight2" Grid.ColumnSpan="3" Grid.RowSpan="2">
                        <Border.Background>
                            <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                <LinearGradientBrush.GradientStops>
                                    <GradientStop Color="#80FFFFFF" Offset="0.05" />
                                    <GradientStop Color="#00FFFFFF" Offset="0.25" />
                                </LinearGradientBrush.GradientStops>
                            </LinearGradientBrush>
                        </Border.Background>
                    </Border>
                </Grid>
            </Decorator>
            <Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" />
        </Grid>
    </ControlTemplate>


    <!--BreadcrumbBar-->
    <Style TargetType="{x:Type local:BreadcrumbBar}">
        <Setter Property="MinHeight" Value="23"/>
        <Setter Property="Background" Value="#A0FFFFFF"/>
        <Setter Property="BorderBrush" Value="{StaticResource borderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:BreadcrumbBar}">
                    <ControlTemplate.Resources>
                        <Style TargetType="{x:Type Button}">
                            <Setter Property="Template" Value="{StaticResource ButtonTemplate}"/>
                            <Setter Property="MinWidth" Value="21"/>
                            <Setter Property="BorderThickness" Value="1"/>
                            <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                            <Setter Property="BorderBrush" Value="Black"/>
                            <Setter Property="Focusable" Value="{Binding Focusable, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:BreadcrumbBar}}}"/>
                        </Style>
                        <Style TargetType="{x:Type local:BreadcrumbButton}">
                            <Setter Property="Focusable" Value="{Binding Focusable, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:BreadcrumbBar}}}"/>
                        </Style>
                    </ControlTemplate.Resources>
                    <Border Background="{TemplateBinding Background}" SnapsToDevicePixels="True"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            Focusable="False"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Border BorderBrush="White" BorderThickness="{TemplateBinding BorderThickness}" Focusable="False" SnapsToDevicePixels="True">
                            <Grid Margin="-1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <ProgressBar x:Name="progress" Grid.Column="0" Grid.ColumnSpan="4" 
                                             Maximum="{Binding ProgressMaximum,RelativeSource={RelativeSource TemplatedParent}}" 
                                             Minimum="{Binding ProgressMinimum,RelativeSource={RelativeSource TemplatedParent}}" 
                                             Value="{Binding ProgressValue,RelativeSource={RelativeSource TemplatedParent}}" 
                                             Background="Transparent"
                                             BorderThickness="0"
                                             Template="{StaticResource progressBarTemplate}"/>
                                <local:BreadcrumbButton  ItemsSource="{TemplateBinding CollapsedTraces}"  Grid.Column="0"
                                                         x:Name="PART_Root"
                                                         MinWidth="0"
                                                         EnableVisualButtonStyle="False"
                                                         Mode="{TemplateBinding OverflowMode}"
                                                        SelectedItem="{Binding SelectedItem,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                                                        ItemTemplate="{TemplateBinding OverflowItemTemplate}"
                                                         IsImageVisible="True"
                                                         Image="{Binding SelectedBreadcrumb.Image, RelativeSource={RelativeSource TemplatedParent}}"
                                                        ItemTemplateSelector="{TemplateBinding OverflowItemTemplateSelector}"
                                                        IsDropDownPressed="{Binding IsOverflowPressed,RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" >
                                </local:BreadcrumbButton>
                                <ContentPresenter x:Name="container" Grid.Column="1" Content="{Binding RootItem,RelativeSource={RelativeSource TemplatedParent}}"/>
                                <ToggleButton x:Name="dropDown" Grid.Column="2" 
                                              Focusable="False"
                                              Width="16"
                                              Visibility="Collapsed"
                                              FocusVisualStyle="{x:Null}"
                                              Template="{StaticResource DropDownButtonTemplate}" 
                                    ClickMode="Press"
                                              IsChecked="{Binding IsDropDownOpen,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                                              Margin="-1"
                                              BorderThickness="1"  
                                              BorderBrush="{StaticResource borderBrush}" />
                                <ComboBox x:Name="PART_ComboBox"                                             
                                          Visibility="Hidden"
                                          Margin="0,0,0,0"
                                          IsEditable="True"
                                          Focusable="True"
                                          ItemTemplate="{TemplateBinding DropDownItemTemplate}"
                                          ItemTemplateSelector="{TemplateBinding DropDownItemTemplateSelector}"
                                          ItemsSource="{Binding DropDownItems,RelativeSource={RelativeSource TemplatedParent}}"
                                          BorderThickness="0"
                                          Grid.Column="0"
                                          SelectedIndex="{Binding SelectedDropDownIndex,RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}"
                                          Grid.ColumnSpan="3"/>
                                <ItemsControl  x:Name="buttons"  Grid.Column="3" Margin="1,0,-1,0" ItemsSource="{Binding Buttons,RelativeSource={RelativeSource TemplatedParent} }"  Focusable="False"  >
                                    <ItemsControl.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <StackPanel Orientation="Horizontal" IsItemsHost="True"/>
                                        </ItemsPanelTemplate>
                                    </ItemsControl.ItemsPanel>
                                </ItemsControl>
                            </Grid>
                        </Border>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Visibility" Value="Visible" SourceName="PART_ComboBox">
                            <!--hide the breadcrumb container and root button  if the combobox is visible, otherwise a breadcrumb button could get the focus on mouseover: -->
                            <Setter Property="Visibility" Value="Hidden" TargetName="container"/>
                            <Setter Property="Visibility" Value="Hidden" TargetName="PART_Root"/>
                        </Trigger>
                        <Trigger Property="IsRootSelected" Value="True">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_Root"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Duration="0:0:0.3" To="White" Storyboard.TargetProperty="Background.Color"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimation Duration="0:0:0.3" From="White" Storyboard.TargetProperty="Background.Color"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="HasDropDownItems" Value="True">
                            <Setter Property="Visibility" Value="Visible" TargetName="dropDown"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!--BreadcrumbButton-->
    <Style TargetType="{x:Type local:BreadcrumbButton}">
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="Background" Value="{StaticResource mouseOverBtnBrush}"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">

            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:BreadcrumbButton}">
                    <Grid Margin="{TemplateBinding Padding}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <local:AeroChrome Grid.Column="0"
                                          Visibility="Visible"
                                          x:Name="button"
                                          Focusable="False"
                                          Margin="-1"                                         
                                          BorderThickness="1"       
                                           RenderPressed="{TemplateBinding IsPressed}"
                                          RenderMouseOver="{TemplateBinding IsMouseOver}">
                            <local:AeroChrome.Content>
                                <StackPanel Orientation="Horizontal">
                                    <Image x:Name="image"  Source="{Binding Image, RelativeSource={RelativeSource TemplatedParent}}" Width="16" Height="16" Stretch="Fill"/>
                                    <ContentPresenter Content="{TemplateBinding Header}" ContentTemplate="{TemplateBinding HeaderTemplate}" Margin="2,0,2,0"/>
                                </StackPanel>
                            </local:AeroChrome.Content>
                        </local:AeroChrome>

                        <!--Content="{TemplateBinding Header}"/>-->
                        <local:AeroChrome Grid.Column="1" x:Name="PART_DropDown"
                                          Focusable="False"
                                          MinWidth="16"
                                          Margin="-1"
                                          BorderThickness="1"
                                           RenderPressed="{TemplateBinding IsDropDownPressed}"
                                          RenderMouseOver="{TemplateBinding IsMouseOver}"
                                          ContentTemplate="{TemplateBinding DropDownContentTemplate}" 
                                          >
                            <local:AeroChrome.Content>
                                <Path x:Name="dropDownPath" Fill="Black" Data="{StaticResource RightArrow}" SnapsToDevicePixels="True"  HorizontalAlignment="Center"/>
                            </local:AeroChrome.Content>
                            <local:AeroChrome.ContextMenu>
                                <ContextMenu x:Name="PART_Menu"                                                
                                              IsTextSearchEnabled="True"
                                                 HorizontalOffset="-14"
                                               ItemContainerStyle="{x:Null}"
                                                 IsOpen="{Binding IsDropDownPressed, RelativeSource={RelativeSource TemplatedParent},Mode=TwoWay}">
                                    <ContextMenu.Template>
                                        <ControlTemplate TargetType="ContextMenu" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:mwt="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
                                            <mwt:SystemDropShadowChrome Color="#00FFFFFF" Name="Shdw" SnapsToDevicePixels="True" MaxHeight="400">
                                                <Border BorderThickness="{TemplateBinding Border.BorderThickness}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}">
                                                    <Grid>
                                                        <Rectangle RadiusX="2" RadiusY="2" Fill="#FFF1F1F1" Width="22" Margin="2,2,2,2" HorizontalAlignment="Left" />
                                                        <Rectangle Fill="#FFE2E3E3" Width="1" Margin="25,2,0,2" HorizontalAlignment="Left" />
                                                        <Rectangle Fill="#FFFFFFFF" Width="1" Margin="26,2,0,2" HorizontalAlignment="Left" />
                                                        <ScrollViewer CanContentScroll="True" Margin="1,0,1,0" Grid.ColumnSpan="2" VerticalScrollBarVisibility="Auto" >
                                                            <ItemsPresenter Margin="{TemplateBinding Control.Padding}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Cycle" />
                                                        </ScrollViewer>
                                                    </Grid>
                                                </Border>
                                            </mwt:SystemDropShadowChrome>
                                            <ControlTemplate.Triggers>
                                                <Trigger Property="ContextMenuService.HasDropShadow">
                                                    <Setter Property="FrameworkElement.Margin" TargetName="Shdw">
                                                        <Setter.Value>
                                                            <Thickness>0,0,5,5</Thickness>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Setter Property="mwt:SystemDropShadowChrome.Color" TargetName="Shdw">
                                                        <Setter.Value>
                                                            <Color>#71000000</Color>
                                                        </Setter.Value>
                                                    </Setter>
                                                    <Trigger.Value>
                                                        <s:Boolean>True</s:Boolean>
                                                    </Trigger.Value>
                                                </Trigger>
                                            </ControlTemplate.Triggers>
                                        </ControlTemplate>
                                    </ContextMenu.Template>
                                </ContextMenu>
                            </local:AeroChrome.ContextMenu>
                        </local:AeroChrome>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsImageVisible" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="image"/>
                        </Trigger>
                        <Trigger Property="Image" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="image"/>
                        </Trigger>
                        <Trigger Property="EnableVisualButtonStyle" Value="False">
                            <Setter TargetName="button" Property="MouseOverBackground" Value="Transparent"/>
                            <Setter TargetName="button" Property="MousePressedBackground" Value="Transparent"/>
                            <Setter TargetName="button" Property="BorderBrush" Value="Transparent"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Header" Value="{x:Null}"/>
                                <Condition Property="IsImageVisible" Value="False"/>
                                <Condition Property="Image" Value="{x:Null}"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Visibility" Value="Collapsed" TargetName="button"/>
                        </MultiTrigger>
                        <Trigger Property="HasItems" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="PART_DropDown"/>
                        </Trigger>
                        <Trigger Property="Mode" Value="Overflow">
                            <Setter Property="Data" Value="{StaticResource OverflowArrow}" TargetName="dropDownPath"/>
                            <Setter Property="Fill" Value="Transparent" TargetName="dropDownPath"/>
                            <Setter Property="Stroke" Value="Black" TargetName="dropDownPath"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="RenderPressed" Value="True" TargetName="PART_DropDown"/>
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused" Value="True">
                            <Setter Property="RenderMouseOver" Value="True" TargetName="PART_DropDown"/>
                            <Setter Property="RenderMouseOver" Value="True" TargetName="button"/>
                        </Trigger>
                        <Trigger Property="IsDropDownVisible" Value="False">
                            <Setter TargetName="PART_DropDown" Property="Visibility" Value="Collapsed"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True" SourceName="PART_DropDown"/>
                                <Condition Property="EnableVisualButtonStyle" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="MouseOverBackground" Value="{StaticResource GradientBorderBrush}" TargetName="button"/>
                        </MultiTrigger>
                        <Trigger Property="IsButtonVisible" Value="False">
                            <Setter Property="Visibility" Value="Collapsed" TargetName="button"/>
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsDropDownPressed" Value="True"/>
                                <Condition Property="Mode" Value="Breadcrumb"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Data" Value="{StaticResource DownArrow}" TargetName="dropDownPath"/>
                            <Setter Property="RenderPressed" Value="True" TargetName="button"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:AeroChrome}">
        <Setter Property="MouseOverBackground" Value="{StaticResource mouseOverBtnBrush}"/>
        <Setter Property="MousePressedBackground" Value="{StaticResource mousePressedBtnBrush}"/>
        <Setter Property="BorderBrush" Value="{StaticResource borderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:AeroChrome}">
                    <Grid Margin="{TemplateBinding Padding}">
                        <Border x:Name="mouseOverBtn"
                                    Opacity="0"
                                    Background="{TemplateBinding MouseOverBackground}"
                                    BorderBrush="{TemplateBinding BorderBrush}" 
                                    BorderThickness="{TemplateBinding BorderThickness}" 
                                    SnapsToDevicePixels="True">
                            <Border x:Name="innerButton" SnapsToDevicePixels="True"
                                        BorderThickness="1"
                                        BorderBrush="White"/>
                        </Border>
                        <Border x:Name="mouseDownBtn" 
                                    Opacity="0"
                                    Background="{TemplateBinding MousePressedBackground}"
                                    BorderBrush="{TemplateBinding BorderBrush}" 
                                    BorderThickness="{TemplateBinding BorderThickness}" 
                                    SnapsToDevicePixels="True">
                            <Border x:Name="innerButton2" SnapsToDevicePixels="False"
                                        BorderThickness="1.2,1.2,0,0"
                                        BorderBrush="{StaticResource borderShadowBrush}"/>
                        </Border>
                        <ContentPresenter Content="{TemplateBinding Content}" 
                                          x:Name="content"
                                          VerticalAlignment="Center"
                                          HorizontalAlignment="Center"
                                          Margin="4,2,4,2"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="RenderMouseOver" Value="True">
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard >
                                        <DoubleAnimation Storyboard.TargetName="mouseOverBtn" Storyboard.TargetProperty="Opacity" Duration="0:0:0.25" To="1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard >
                                        <DoubleAnimation Storyboard.TargetName="mouseOverBtn" Storyboard.TargetProperty="Opacity" Duration="0:0:0.25" To="0"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                        </Trigger>
                        <Trigger Property="RenderPressed" Value="True">
                            <Setter Property="Opacity" TargetName="mouseDownBtn" Value="1"/>
                            <Setter Property="Margin" TargetName="content" Value="5,3,3,1"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
